<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <link href="/static/layui/css/layui.css" rel="stylesheet" type="text/css">
</head>
<div style="padding:10px 50px 10px 10px">
    <form id="recordForm" method="post" action="/pc/biz/classify/edit" class="layui-form">
        <div style="margin-bottom:20px;font-size:14px;border-bottom:1px solid #ccc; padding-bottom: 5px;">故障分类信息</div>
        <input type="hidden" name="id" value="${classify.id}"/>
        <div class="layui-form-item">
            <label class="layui-form-label">区域</label>
            <div class="layui-input-block">
                <select name="locationId" lay-verify="required">
                    <option value=""></option>
                    @@ for(area in areas){ $$
                    <option value="${area.id}" ${classify.locationId == area.id ? "selected" : ""}>${area.name}</option>
                    @@ } $$
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input class="layui-input" name="name" value="${classify.name}" lay-verify="required" />
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button id="submitButton" class="layui-btn" lay-submit lay-filter="*">保存</button>
                <button type="button" class="layui-btn layui-btn-primary" onclick="closeAll()">取消</button>
            </div>
        </div>
    </form>
</div>
<script src="/static/jquery/jquery.min.js"></script>
<script src="/static/layui/layui.js"></script>
<script src="/static/jqgrid/jquery.jqGrid.minffe4.js?0820"></script>
<script src="/static/jqgrid/myjqGrid.js?v=1.0.1"></script>
<script type="text/javascript">
    layui.use('form', function(){
        var form = layui.form;
        form.on('submit(*)', function(data){
            var form = $("#recordForm");
            var formData = form.serialize();
            formData.detail = $("#detail").html();
            $.post(form.attr("action"), formData, function(data){
                if(data.status == 200){
                    layer.alert(data.msg, {
                        icon: 1,
                        skin: 'layer-ext-moon'
                    },function () {
                        parent.myJqGrid.reloadGrid({});
                        parent.layer.closeAll();
                    });
                }else{
                    layer.alert(data.msg, {
                        icon: 2,
                        skin: 'layer-ext-moon'
                    });
                }
            });
            return false; //阻止表单跳转。
        });
    });
    function closeAll() {
        parent.layer.closeAll();
    }
</script>